package ru.eas;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

/**
 * @author aesipov
 */
public class Test {
    public static void main(String[] args) {
        System.out.println(Integer.MAX_VALUE);
        System.out.println(Long.MAX_VALUE);
        System.out.println((long) Integer.MAX_VALUE * (long) Integer.MAX_VALUE);

//        Integer[] ar = new Integer[10];
        ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(new Integer(0), new Integer(1)));
        list.add(new Integer(12));
        System.out.println(Arrays.toString(list.toArray()));

        String xString = "239030239030566179";
        String yString = "56617956617923930";
//        String xString = "10";
//        String yString = "1011";

        LinkedList<Integer> x = getNumberList(xString);

        System.out.println(Arrays.toString(x.toArray()));
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < x.size(); i++) {
            String str = x.get(i).toString();
            for (int j = 0; j < 9 - str.length(); j++) {
                sb.append("0");
            }
            sb.append(str);
        }
        System.out.println(xString);
        System.out.println(sb.toString());

    }

    private static LinkedList<Integer> getNumberList(String numberString) {
        LinkedList<Integer> result = new LinkedList<Integer>();
        for (int i = numberString.length(); i >= 0 ; i = i - 9) {
            int left = i - 9;
            int right = i;
            if (left > 0) {
                result.addFirst(Integer.valueOf(numberString.substring(left, right)));
            } else {
                result.addFirst(Integer.valueOf(numberString.substring(0, right)));
                break;
            }
        }
        return result;
    }
}
